package com.awn.weidian.demo.controller;


import com.awn.weidian.demo.mapper.IGoods;
import com.awn.weidian.demo.mapper.IMsgs;
import com.awn.weidian.demo.pojo.Goods;
import com.awn.weidian.demo.pojo.Msgs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/api/")
public class MsgsController {

    /**
     *
     */
    @Autowired
    private IMsgs im;

    @GetMapping("/selectMsgs")
    public List<Msgs> selectMsgs(Msgs msgs){
        return im.selectMsgs();
    }

    @GetMapping("/showMsgs/{mid}")
    public List<Msgs> showget(Msgs smgs , @PathVariable int mid){
        return im.showMsgs(mid);
    }

    @PostMapping("/addMsgs")
    public int addMsgs(@RequestBody Msgs msgs){
        return im.addMsgs(msgs);
    }


    @DeleteMapping("/deleteMsgs/{mid}")
    public int deleteMsgs(@PathVariable int mid){
        return im.deleteMsgs(mid);
    }

    @PostMapping("/updateMsgs")
    public int updateMsgs(@RequestBody Msgs msgs){
        return im.updateMsgs(msgs);
    }



}
